package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaListadoVenta extends javax.swing.JFrame {
	private JPanel panListadoVenta;
	private JLabel lblListadoVentas;
	private JScrollPane scpListadoVenta;
	private JButton btnSalir;
	private JButton btnMonto;
	private JButton btnCantidad;
	private JTable tblListadoVenta;
	private JButton btnLimpiar;

	public VentanaListadoVenta() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			setTitle("Ventas");
			{
				panListadoVenta = new JPanel();
				getContentPane().add(panListadoVenta, BorderLayout.CENTER);
				panListadoVenta.setLayout(null);
				panListadoVenta.setBackground(new java.awt.Color(255,255,255));
				{
					lblListadoVentas = new JLabel();
					panListadoVenta.add(lblListadoVentas);
					lblListadoVentas.setText("Listado de Ventas");
					lblListadoVentas.setBounds(34, 29, 193, 20);
					lblListadoVentas.setForeground(new java.awt.Color(18,6,249));
					lblListadoVentas.setFont(new java.awt.Font("Comic Sans MS",1,12));
				}
				{
					scpListadoVenta = new JScrollPane();
					panListadoVenta.add(scpListadoVenta);
					scpListadoVenta.setBounds(34, 66, 508, 246);
					{
						TableModel tblListadoVentaModel = 
							new DefaultTableModel();
						tblListadoVenta = new JTable();
						scpListadoVenta.setViewportView(tblListadoVenta);
						tblListadoVenta.setModel(tblListadoVentaModel);
					}
				}
				{
					btnLimpiar = new JButton();
					panListadoVenta.add(btnLimpiar);
					btnLimpiar.setText("Limpiar");
					btnLimpiar.setBounds(297, 348, 105, 34);
					btnLimpiar.setFont(new java.awt.Font("Comic Sans MS",1,12));
					btnLimpiar.setForeground(new java.awt.Color(252,221,3));
					btnLimpiar.setBackground(new java.awt.Color(18,6,249));
				}
				{
					btnSalir = new JButton();
					panListadoVenta.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(419, 348, 92, 34);
					btnSalir.setFont(new java.awt.Font("Comic Sans MS",1,12));
					btnSalir.setForeground(new java.awt.Color(252,221,3));
					btnSalir.setBackground(new java.awt.Color(18,6,249));
				}
				{
					btnCantidad = new JButton();
					panListadoVenta.add(btnCantidad);
					btnCantidad.setText("Por Cantidad");
					btnCantidad.setBounds(39, 348, 116, 34);
					btnCantidad.setFont(new java.awt.Font("Comic Sans MS",1,12));
					btnCantidad.setForeground(new java.awt.Color(252,221,3));
					btnCantidad.setBackground(new java.awt.Color(18,6,249));
				}
				{
					btnMonto = new JButton();
					panListadoVenta.add(btnMonto);
					btnMonto.setText("Por Monto");
					btnMonto.setBounds(176, 348, 103, 33);
					btnMonto.setFont(new java.awt.Font("Comic Sans MS",1,12));
					btnMonto.setForeground(new java.awt.Color(252,221,3));
					btnMonto.setBackground(new java.awt.Color(18,6,249));
				}
			}
			pack();
			this.setSize(585, 441);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void addListener(ActionListener actionListener){
		btnLimpiar.addActionListener(actionListener);
		btnCantidad.addActionListener(actionListener);
		btnMonto.addActionListener(actionListener);
		btnSalir.addActionListener(actionListener);
	}
	
	public void setResultados(AbstractTableModel abstractTableModel) {
		tblListadoVenta.setModel(abstractTableModel);
	}
	
	public void limpiarTabla(){
		TableModel tblListadoVentaModel = 
			new DefaultTableModel();
		tblListadoVenta.setModel(tblListadoVentaModel);
	}

}
